﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Globalization;

namespace Jbe.TestSuite.Infrastructure.Shell.Presentation
{
    public class NegationConverter : IValueConverter
    {
        private static readonly NegationConverter @default = new NegationConverter();

        public static NegationConverter Default { get { return @default; } }


        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is bool)
            {
                return !(bool)value;
            }
            throw new NotSupportedException("The value type is not supported");
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is bool)
            {
                return !(bool)value;
            }
            throw new NotSupportedException("The value type is not supported");
        }
    }
}
